package com.example.qrcode.vo;
import java.util.Date;

public class ProductVO {
    private String productSNo;
    private String productDefinitionId;
    private String productPrefix;
    private String base64QrCode;
    private Date createTime;
    private String creator;
    private Integer generateCount;
    private Date lastGenerateTime;
    private String deviceId;
    private String installationLocation;
    private String applicationScenario;
    private Integer lineNum; // 出线数量
    private Date updateTime;
    private String onlineStatus;


    public String getOnlineStatus() {
        if (this.updateTime == null) {
            return "未上过线";
        }
        // 判断是否在线（比如1小时内有数据）
        long oneHourAgo = System.currentTimeMillis() - 3600 * 1000;
        if (this.updateTime.getTime() > oneHourAgo) {
            return "在线";
        } else {
            return "离线";
        }
    }
    // Getters and Setters
    public String getProductSNo() { return productSNo; }
    public void setProductSNo(String productSNo) { this.productSNo = productSNo; }

    public String getProductDefinitionId() { return productDefinitionId; }
    public void setProductDefinitionId(String productDefinitionId) { this.productDefinitionId = productDefinitionId; }

    public String getProductPrefix() { return productPrefix; }
    public void setProductPrefix(String productPrefix) { this.productPrefix = productPrefix; }

    public String getBase64QrCode() { return base64QrCode; }
    public void setBase64QrCode(String base64QrCode) { this.base64QrCode = base64QrCode; }

    public Date getCreateTime() { return createTime; }
    public void setCreateTime(Date createTime) { this.createTime = createTime; }

    public String getCreator() { return creator; }
    public void setCreator(String creator) { this.creator = creator; }

    public Integer getGenerateCount() { return generateCount; }
    public void setGenerateCount(Integer generateCount) { this.generateCount = generateCount; }

    public Date getLastGenerateTime() { return lastGenerateTime; }
    public void setLastGenerateTime(Date lastGenerateTime) { this.lastGenerateTime = lastGenerateTime; }

    public String getDeviceId() { return deviceId; }
    public void setDeviceId(String deviceId) { this.deviceId = deviceId; }

    public String getInstallationLocation() { return installationLocation; }
    public void setInstallationLocation(String installationLocation) { this.installationLocation = installationLocation; }

    public String getApplicationScenario() { return applicationScenario; }
    public void setApplicationScenario(String applicationScenario) { this.applicationScenario = applicationScenario; }

    public Integer getLineNum() { return lineNum; }
    public void setLineNum(Integer lineNum) { this.lineNum = lineNum; }

    public Date getUpdateTime() { return updateTime; }
    public void setUpdateTime(Date updateTime) { this.updateTime = updateTime; }


    public void setOnlineStatus(String onlineStatus) { this.onlineStatus = onlineStatus; }
}
